<!DOCTYPE html>
<html lang="en">
<head>
  <link rel="stylesheet" href="/bootstrap/css/bootstrap.min.css"  crossorigin="anonymous">
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>左右结构页面</title>
  <style>
    body {
      margin: 0;
      font-family: Arial, sans-serif;
    }
    .container {
      display: flex;
      flex-direction: column;
      height: 100vh;
    }
    .header {
      background-color: #D3D3D3;
      color: white;
      padding: 20px;
      text-align: center;
    }
    .main {
    // flex: 1;
      padding: 20px;
      background-color: #f5f5f5;


    }
    .left {
      display: inline-block;
      width: 20%; /* 占据40% */
      background-color: #f4f4f4;
      padding: 20px;
    }
    .content {
      display: inline-block;
      width: 80%; /* 占据60% */
      background-color: #e4e4e4;
      padding: 20px;
    }
    .footer {
      background-color: #D3D3D3;
      color: white;
      padding: 10px;
      text-align: center;
    }

    .circle-avatar {
      width: 100px; /* 图片宽度 */
      height: 100px; /* 图片高度 */
      border-radius: 50%; /* 设置为圆形 */
      object-fit: cover; /* 确保图片填充整个区域 */
    }

  </style>
</head>
<body>

<div class="container">
<!--  <div class="row" th:replace="header.html"></div>-->
  <div class="row">
<!--    <div class="col-3"  th:replace="left.html" ></div>-->
    <div class="col-10">
      <button type="button" id="addStudentButton" class="btn btn-outline-primary"  >新增学生</button>

      <table class="table table-striped" >
        <thead>
        <tr>
          <th scope="col">id</th>
          <th scope="col">name</th>
          <th scope="col">password</th>
          <th scope="col">性别</th>
          <th scope="col">班级</th>
          <th scope="col">生日</th>
          <th scope="col">成绩</th>
          <th scope="col">操作</th>
        </tr>
        </thead>
        <tbody>
        <tr th:each="student:${students}">
          <td th:text="${student.id}" ></td>
          <td th:text="${student.name}"></td>
          <td th:text="${student.password}"></td>
          <td th:text="${student.sex==1?'男':'女'}"></td>
          <td th:text="${student.clazz}"></td>
          <td th:text="${student.birthday}"></td>
<!--          <td>-->
<!--            <div th:each="studentScore:${student.scores}">-->
<!--              <span th:text="${studentScore.course.name}"/>-->
<!--              <span th:text="${studentScore.score}"/>-->
<!--&lt;!&ndash;              &#10;&#13;&ndash;&gt;-->
<!--            </div>-->
<!--          </td>-->
          <td ><a th:href="@{/Student/toEdit(id=${student.id})}">修改</a>
            <a th:href="@{/Student/remove(id=${student.id})}">删除</a></td>
        </tr>
        </tbody>
      </table>
      <nav aria-label="...">
        <ul class="pagination">
          <li class="page-item ">
            <a class="page-link" th:href="@{/Student/list/{currPage}/3(currPage=${currPage}-1)}">Previous</a>
          </li>
          <li class="page-item"><a class="page-link" th:href="@{/Student/list/1/3}">1</a></li>
          <li class="page-item " aria-current="page">
            <a class="page-link" th:href="@{/Student/list/2/3}">2</a>
          </li>
          <li class="page-item"><a class="page-link" th:href="@{/Student/list/3/3}">3</a></li>
          <li class="page-item">
            <a class="page-link" th:href="@{/Student/list/{currPage}/3(currPage=${currPage}+1)}">Next</a>
          </li>
        </ul>
      </nav>
    </div>
  </div>
<!--  <div th:replace="footer.html"></div>-->
</div>
<script src="/bootstrap/js/jquery.min.js"  crossorigin="anonymous"></script>
<script src="/bootstrap/js/bootstrap.bundle.min.js"  crossorigin="anonymous"></script>
<script>
  function addStudent() {
    window.location.href = "/Student/toPage?page=addStudent";

  }
  // 获取按钮并绑定点击事件
  document.addEventListener("DOMContentLoaded", function() {
    var button = document.getElementById("addStudentButton");
    button.addEventListener("click", addStudent);
  });
</script>
</body>
</html>